// Copyright (c) 2021 Presto Labs Pte. Ltd.
// Author: fengyang

#include "coin2/exchange/bybit/symbology/currency.h"

#include <gtest/gtest.h>

TEST(BybitCurrency, constructor) {
  using namespace coin2::exchange::bybit::symbology;
  using coin2::exchange::base::market::ExchangeType;
  using coin2::exchange::base::market::MarketType;

  int64_t resolve_ts = 1624859286 * 1e9;

  BybitCurrency usdt("USDT");
  EXPECT_EQ(usdt.currency(), "USDT");
  EXPECT_EQ(usdt.native_currency(MarketType::Futures), "USDT");
  EXPECT_EQ(usdt.rep_currency(), "USD");
  EXPECT_EQ(usdt.exchange(), ExchangeType::Bybit);

  auto btc1 = BybitCurrency::FromNativeStr("BTC", resolve_ts);
  EXPECT_EQ(btc1.currency(), "BTC");
  EXPECT_EQ(btc1.native_currency(MarketType::Futures), "BTC");
  EXPECT_EQ(btc1.exchange(), ExchangeType::Bybit);

  auto btc2 = BybitCurrency::FromNativeStr("BTC", resolve_ts);
  auto btc3 = BybitCurrency::FromNormStr("BTC", resolve_ts);
  auto btc4 = BybitCurrency::FromStr("BTC", resolve_ts);
  EXPECT_EQ(btc2, btc1);
  EXPECT_EQ(btc3, btc1);
  EXPECT_EQ(btc4, btc1);

  auto bch = BybitCurrency::FromStr("BCH", resolve_ts);
  EXPECT_EQ(bch.currency(), "BCHN");
  EXPECT_EQ(bch.native_currency(MarketType::Futures), "BCH");

  auto xlm = BybitCurrency::FromStr("XLM", resolve_ts);
  EXPECT_EQ(xlm.currency(), "XLM");
}
